package com.itheima.Test5;

import org.omg.PortableInterceptor.INACTIVE;

import java.util.ArrayList;
import java.util.Random;

public class Qiang implements  Runnable{
    Random r = new Random();
    int x;
    ArrayList<Integer> list = new ArrayList<>();
    @Override
    public void run() {
        while (true){
            synchronized (Test.lock){
                if (Test.count<=0)break;
                for (;;) {
                    x=r.nextInt(33)+1;
                    if (!list.contains(x)){
                        if (list.size()<6){
                            list.add(x);
                        }else{
                            list.add(r.nextInt(16)+1);
                           break;
                        }
                    }
                }
                Test.count--;
                System.out.println("编号为"+(Test.count-100)+"在"+Thread.currentThread().getName()+"拿到:"+list);
                list.clear();
            }
        }
    }
}
